package cqrtplm.mapper;


import cqrtplm.dto.GroupSegmNumDTO;
import cqrtplm.dto.query.RtSegmNumQueryDTO;
import cqrtplm.entity.RtSegmNumDO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface RtSegmNumMapper {
    int insert(RtSegmNumDO record);

    int update(RtSegmNumDO record);

    int delete(String id);

    RtSegmNumDO selectById(String id);

    List<RtSegmNumDO> selectAll(RtSegmNumQueryDTO dto);

    int insertByGroupAndSegm(@Param("dto") GroupSegmNumDTO.GroupDTO dto,
                             @Param("result") String result,
                             @Param("drawingMaterialAuth")String drawingMaterialAuth);

    List<String> selectGroupSegmByGroupId(@Param("groupId") String groupId);

    List<RtSegmNumDO> querySegmNumByCategory(@Param("parts") String parts);

    @Delete("delete from RT_CFG_GROUP_SEGMNUM where GROUPID=#{groupId}")
    int deleteGroupSegmByGroupId(@Param("groupId") String groupId);

    @Select("select POSITION_ as position from RT_CFG_SEGMENT_NUMBER where ID_=#{attrValue}")
    String selectPositionById(@Param("attrValue") String attrValue);

    List<String> selectSegmByGroupIds(@Param("groupIds") List<String> groupIds, @Param("segmNumId") String segmNumId);

    List<String> selectAuthByGroupIds(@Param("groupIds") List<String> groupIds, @Param("segmNumId") String segmNumId);
}
